home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Shutdown FX 1.3 Source / Shutdown FX ƒ / sfx wipes ƒ / Diagonal wipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-14  |  2.1 KB  |  70 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Diagonal wipe.c
  4.  
  5. Purpose:    This module handles clearing the screen in a funky
  6.             manner.  See the comments below for more details.
  7.             
  8.  
  9. Shutdown FX -=- graphic effects on shutdown
  10. Copyright (C) 1993 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define BoxSize 13
  32. #define CorrectTime 2
  33.  
  34. void DiagonalWipe(Pattern *thePattern, int width, int height);
  35.  
  36. /* If you make a long enough region starting at the bottomright corner and
  37.    making a strip up and right of <BoxSize> width, all you have to do is move
  38.    the region left until the entire screen is filled.  Dave thinks ideas like
  39.    this should be taken out and shot, but it works. */
  40.    
  41. void DiagonalWipe(Pattern *thePattern, int width, int height)
  42. {
  43.     int                counter,maxmax;
  44.     Rect            source;
  45.     RgnHandle        archie;
  46.     
  47.     maxmax=width+BoxSize;
  48.     archie=NewRgn();
  49.     OpenRgn();
  50.         MoveTo(width+BoxSize,height+BoxSize);
  51.         Line(0,BoxSize);
  52.         Line(-maxmax,maxmax);
  53.         Line(-BoxSize,0);
  54.         Line(maxmax,-maxmax);
  55.     CloseRgn(archie);
  56.     source.top=source.left=0;
  57.     source.bottom=height;
  58.     source.right=width;
  59.  
  60.     /* the only tricky part to this code is the starting param for counter */
  61.     for (counter=2+(width+height)/BoxSize; counter>=0; counter--)
  62.     {
  63.         StartTiming();
  64.         OffsetRgn(archie,0,-BoxSize);
  65.         FillRgn(archie, *thePattern);
  66.         TimeCorrection(CorrectTime);
  67.     }
  68.     DisposeRgn(archie);
  69. }
  70.